package com.training.action.xixiaoming;

import com.training.pojo.chengshu.MotorRoom;
import com.training.service.xixiaoming.motorService;

public class addMotorAction {
	private motorService motorser;
	private MotorRoom m;
	private String msg;
	public String execute(){
		if(m.getMotname()==null||m.getMotname().equals("")){
			msg="机房名称不能为空";
			return "error";
		}else{
			String motorname=m.getMotname();
			boolean b=motorser.checkMotorname(motorname);
			if(b){
				msg="添加成功";
				motorser.saveEditMotor(m);
				return "success";}
			else{
				msg="机房名称已存在";
				return "error";
			}
		}
		
	}
	public motorService getMotorser() {
		return motorser;
	}
	public void setMotorser(motorService motorser) {
		this.motorser = motorser;
	}
	public MotorRoom getM() {
		return m;
	}
	public void setM(MotorRoom m) {
		this.m = m;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
}
